# For more information about using CMake with Android Studio, read the
# documentation: https://d.android.com/studio/projects/add-native-code.html

# Sets the minimum version of CMake required to build the native library.

cmake_minimum_required(VERSION 3.10.2)


project("videoffmpeg")


add_library(
        native-lib
        SHARED
        native-lib.c)

find_library(
        log-lib

        log)


include_directories(${CMAKE_SOURCE_DIR}/../../../libs/includes)
set(DIR ${CMAKE_SOURCE_DIR}/../../../libs/arm64-v8a)
MESSAGE("dir===>${DIR}")
MESSAGE("project.dir===>${PROJECT_SOURCE_DIR}")
add_library(avcodec
        SHARED
        IMPORTED)


add_library(avdevice
        SHARED
        IMPORTED)

add_library(avformat
        SHARED
        IMPORTED)

add_library(avutil
        SHARED
        IMPORTED)

add_library(avresample
        SHARED
        IMPORTED)

add_library(swresample
        SHARED
        IMPORTED)

add_library(swscale
        SHARED
        IMPORTED)

add_library(avfilter
        SHARED
        IMPORTED)

set_target_properties(
        avcodec
        PROPERTIES IMPORTED_LOCATION
        ${DIR}/libavcodec.so
)
add_library(
        fdk-aac
        SHARED
        IMPORTED
)
set_target_properties(
        avfilter
        PROPERTIES IMPORTED_LOCATION
        ${DIR}/libavfilter.so
)
set_target_properties(
        avformat
        PROPERTIES IMPORTED_LOCATION
        ${DIR}/libavformat.so
)
set_target_properties(
        avutil
        PROPERTIES IMPORTED_LOCATION
        ${DIR}/libavutil.so
)
set_target_properties(
        swresample
        PROPERTIES IMPORTED_LOCATION
        ${DIR}/libswresample.so
)
set_target_properties(
        swscale
        PROPERTIES IMPORTED_LOCATION
        ${DIR}/libswscale.so
)
set_target_properties(
        fdk-aac
        PROPERTIES IMPORTED_LOCATION
        ${DIR}/libfdk-aac.so
)
target_link_libraries( # Specifies the target library.
        native-lib
        fdk-aac
        avcodec
        avfilter
        avformat
        avutil
        swresample
        swscale
        ${log-lib})